|
In computer science, an array type is a data type that is meant to describe a collection of ''elements'' (values or variables), each selected by one or more indices (identifying keys) that can be computed at run time by the program. Such a collection is usually called an array variable, array value, or simply array.〔Robert W. Sebesta (2001) Concepts of Programming Languages. Addison-Wesley. 4th edition (1998), 5th edition (2001), ISBN 9780201385960〕 By analogy with the mathematical concepts of vector and matrix, array types with one and two indices are often called vector type and matrix type, respectively. Language support for array types may include certain built-in array data types, some syntactic constructions (''array type constructors'') that the programmer may use to define such types and declare array variables, and special notation for indexing array elements.〔 For example, in the Pascal programming language, the declaration type MyTable = array () of integer , defines a new array data type called MyTable . The declaration var A: MyTable then defines a variable A of that type, which is an aggregate of eight elements, each being an integer variable identified by two indices. In the Pascal program, those elements are denoted A() , A() , A() ,… A() .〔K. Jensen and Niklaus Wirth, PASCAL User Manual and Report. Springer. Paperback edition (2007) 184 pages, ISBN 978-3540069508〕 Special array types are often defined by the language's standard libraries.Arrays are distinguished from lists in that arrays allow random access, while lists only allow sequential access. Dynamic lists are also more common and easier to implement than dynamic arrays. Array types are distinguished from record types mainly because they allow the element indices to be computed at run time, as in the Pascal assignment A() := A() . Among other things, this feature allows a single iterative statement to process arbitrarily many elements of an array variable.In more theoretical contexts, especially in type theory and in the description of abstract algorithms, the terms "array" and "array type" sometimes refer to an abstract data type (ADT) also called ''abstract array'' or may refer to an ''associative array'', a mathematical model with the basic operations and behavior of a typical array type in most languages — basically, a collection of elements that are selected by indices computed at run-time. Depending on the language, array types may overlap (or be identified with) other data types that describe aggregates of values, such as lists and strings. Array types are often implemented by array data structures, but sometimes by other means, such as hash tables, linked lists, or search trees. == History == Assembly languages and low-level languages like BCPL〔John Mitchell, Concepts of Programming Languages. Cambridge University Press.〕 generally have no syntactic support for arrays. Because of the importance of array structures for efficient computation, the earliest high-level programming languages, including FORTRAN (1957), COBOL (1960), and Algol 60 (1960), provided support for multi-dimensional arrays. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Array data type」の詳細全文を読む スポンサード リンク
|